<html>
<head><meta charset="utf-8"><title>x.py fmt and emacs don&#x27;t agree · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html">x.py fmt and emacs don&#x27;t agree</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="191151428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191151428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191151428">(Mar 19 2020 at 17:55)</a>:</h4>
<p>So, I have my rust-mode in emacs setup to rustfmt-on-save. I have no real idea what this is invoking, but it doesn't seem to agree with what <code>x.py fmt</code> does. I often get errors like this:</p>
<div class="codehilite"><pre><span></span>Diff in /home/nmatsakis/versioned/rust-3/src/librustc_span/lib.rs at line 403:
     pub fn source_callee(self) -&gt; Option&lt;ExpnData&gt; {
         fn source_callee(expn_data: ExpnData) -&gt; ExpnData {
             let next_expn_data = expn_data.call_site.ctxt().outer_expn_data();
<span class="gd">-            if !next_expn_data.is_root() {</span>
<span class="gd">-                source_callee(next_expn_data)</span>
<span class="gd">-            } else {</span>
<span class="gd">-                expn_data</span>
<span class="gd">-            }</span>
<span class="gi">+            if !next_expn_data.is_root() { source_callee(next_expn_data) } else { expn_data }</span>
         }
         let expn_data = self.ctxt().outer_expn_data();
<span class="gd">-        if !expn_data.is_root() {</span>
<span class="gd">-            Some(source_callee(expn_data))</span>
<span class="gd">-        } else {</span>
<span class="gd">-            None</span>
<span class="gd">-        }</span>
<span class="gi">+        if !expn_data.is_root() { Some(source_callee(expn_data)) } else { None }</span>
     }

     /// Checks if a span is &quot;internal&quot; to a macro in which `#[unstable]`
Diff in /home/nmatsakis/versioned/rust-3/src/librustc_span/lib.rs at line 1234:

         let line_index = lookup_line(&amp;self.lines[..], pos);
         assert!(line_index &lt; self.lines.len() as isize);
<span class="gd">-        if line_index &gt;= 0 {</span>
<span class="gd">-            Some(line_index as usize)</span>
<span class="gd">-        } else {</span>
<span class="gd">-            None</span>
<span class="gd">-        }</span>
<span class="gi">+        if line_index &gt;= 0 { Some(line_index as usize) } else { None }</span>
     }
</pre></div>


<p>Could this maybe be a result of some custom settings in our repo?</p>



<a name="191153201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153201">(Mar 19 2020 at 18:06)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> possible, but somewhat unlikely -- it's more likely that emacs and x.py fmt are using different rustfmts</p>



<a name="191153216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153216">(Mar 19 2020 at 18:07)</a>:</h4>
<p>do you know what emacs is using? I guess you said no</p>



<a name="191153228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153228">(Mar 19 2020 at 18:07)</a>:</h4>
<p>how often does rustfmt change?</p>



<a name="191153242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153242">(Mar 19 2020 at 18:07)</a>:</h4>
<p>I mean I can figure it out but it's surprising to me</p>



<a name="191153266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153266">(Mar 19 2020 at 18:07)</a>:</h4>
<p>once every 6 weeks, roughly</p>



<a name="191153273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153273">(Mar 19 2020 at 18:07)</a>:</h4>
<p>(in tree)</p>



<a name="191153309"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153309" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153309">(Mar 19 2020 at 18:07)</a>:</h4>
<p>right now we're using rustfmt from nightly-2020-01-31</p>



<a name="191153317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153317">(Mar 19 2020 at 18:07)</a>:</h4>
<p>that's how often we cut a new release</p>



<a name="191153393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153393">(Mar 19 2020 at 18:08)</a>:</h4>
<p>but I guess what I meant is how often it changes behavior</p>



<a name="191153408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153408">(Mar 19 2020 at 18:08)</a>:</h4>
<p>right, yes, we try to bump the rustfmt we use from x.py fmt roughly at the same rate, though there's no real reason to do so</p>



<a name="191153437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153437">(Mar 19 2020 at 18:08)</a>:</h4>
<p>I know this difference has persisted for a while, but it's entirely possible that I've not updated the rustfmt I'm using in all that time :)</p>



<a name="191153448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153448">(Mar 19 2020 at 18:08)</a>:</h4>
<p>I'll dig a bit deeper</p>



<a name="191153472"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153472" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153472">(Mar 19 2020 at 18:08)</a>:</h4>
<p>in theory it shouldn't change behavior I think -- not sure -- maybe just bugfixes?</p>



<a name="191153511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153511">(Mar 19 2020 at 18:08)</a>:</h4>
<p>to be honest I don't really know what rustfmt maintenance looks like these days</p>



<a name="191153528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153528">(Mar 19 2020 at 18:09)</a>:</h4>
<p>(in terms of rate of change etc)</p>



<a name="191153688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153688">(Mar 19 2020 at 18:10)</a>:</h4>
<p>OK, I <em>think</em> emacs is running <code>~/.cargo/bin/rustfmt</code></p>



<a name="191153697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153697">(Mar 19 2020 at 18:10)</a>:</h4>
<p>I can configure this</p>



<a name="191153718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153718">(Mar 19 2020 at 18:10)</a>:</h4>
<p>I probably want to write my own executable that will snoop and see if I'm in a rust directory...</p>



<a name="191153775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153775">(Mar 19 2020 at 18:11)</a>:</h4>
<p>I do let g:rustfmt_command = "/Users/mark/Edit/rust/build/x86_64-apple-darwin/stage0/bin/rustfmt"</p>



<a name="191153779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153779">(Mar 19 2020 at 18:11)</a>:</h4>
<p>(for vim)</p>



<a name="191153786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153786">(Mar 19 2020 at 18:11)</a>:</h4>
<p>that said, we do have a rustfmt.toml with</p>
<div class="codehilite"><pre><span></span><span class="c1"># Run rustfmt with this config (it should be picked up automatically).</span>
<span class="n">version</span> <span class="o">=</span> <span class="s">&quot;Two&quot;</span>
<span class="n">use_small_heuristics</span> <span class="o">=</span> <span class="s">&quot;Max&quot;</span>
<span class="n">merge_derives</span> <span class="o">=</span> <span class="kc">false</span>
</pre></div>



<a name="191153815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153815">(Mar 19 2020 at 18:11)</a>:</h4>
<p>rustfmt should auto-read that, independent of which rustfmt runs, afaik</p>



<a name="191153836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153836">(Mar 19 2020 at 18:11)</a>:</h4>
<p>(and from where etc)</p>



<a name="191153865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153865">(Mar 19 2020 at 18:11)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don't.20agree/near/191153775" title="#narrow/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don't.20agree/near/191153775">said</a>:</p>
<blockquote>
<p>I do let g:rustfmt_command = "/Users/mark/Edit/rust/build/x86_64-apple-darwin/stage0/bin/rustfmt"</p>
</blockquote>
<p>I have many directories</p>



<a name="191153877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153877">(Mar 19 2020 at 18:11)</a>:</h4>
<p>so I wouldn't want to hard-code a path</p>



<a name="191153924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153924">(Mar 19 2020 at 18:12)</a>:</h4>
<p>but I think I remember also that relative paths didn't work for some reason or something...</p>



<a name="191153941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153941">(Mar 19 2020 at 18:12)</a>:</h4>
<p>hm, this should be only for rust-lang/rust directories?</p>



<a name="191153952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153952">(Mar 19 2020 at 18:12)</a>:</h4>
<p>that said, I think I could use the "per directory" settings to configure this differently for each of my directories</p>



<a name="191153966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153966">(Mar 19 2020 at 18:12)</a>:</h4>
<p>i.e. you can just have one where you've run x.py recently in theory</p>



<a name="191153973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191153973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191153973">(Mar 19 2020 at 18:12)</a>:</h4>
<p>I feel like I tried this and had a problem, I can't remember why</p>



<a name="191154014"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191154014" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191154014">(Mar 19 2020 at 18:12)</a>:</h4>
<p>or install the same nightly toolchain as the one we use in x.py (from src/stage0.txt) and then use that</p>



<a name="191154018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191154018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191154018">(Mar 19 2020 at 18:12)</a>:</h4>
<p>I'd rather have it do the right thing</p>



<a name="191154050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191154050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191154050">(Mar 19 2020 at 18:13)</a>:</h4>
<p>than require some manual work from me every 6 weeks</p>



<a name="191154052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191154052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191154052">(Mar 19 2020 at 18:13)</a>:</h4>
<p>but yes</p>



<a name="191154103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191154103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191154103">(Mar 19 2020 at 18:13)</a>:</h4>
<p>do you have <code>+stage1</code> set up? you could do the same for this in theory</p>



<a name="191154121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191154121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191154121">(Mar 19 2020 at 18:13)</a>:</h4>
<p>I have e.g. +rust-1-stage1 etc</p>



<a name="191154132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191154132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191154132">(Mar 19 2020 at 18:13)</a>:</h4>
<p>ah</p>



<a name="191154137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191154137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191154137">(Mar 19 2020 at 18:13)</a>:</h4>
<p>one for each of my working directories :)</p>



<a name="191154192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191154192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191154192">(Mar 19 2020 at 18:14)</a>:</h4>
<p>I <em>used</em> to use a custom wrapper around rustc that figured out which directory you were in...</p>



<a name="191154201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191154201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191154201">(Mar 19 2020 at 18:14)</a>:</h4>
<p>...but that was a bit overkill, turns out</p>



<a name="191154410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191154410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191154410">(Mar 19 2020 at 18:16)</a>:</h4>
<p>this is a bit crazy, but <code>rustup run --install $(rg --replace '$1' 'rustfmt: (.*)$' src/stage0.txt) rustfmt</code></p>



<a name="191154562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191154562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191154562">(Mar 19 2020 at 18:17)</a>:</h4>
<p>anyway setting the variable in what seemed to be the obvious per-directory way didn't work so...</p>



<a name="191154907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191154907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191154907">(Mar 19 2020 at 18:20)</a>:</h4>
<p>I actually have the same problem and I use vim</p>



<a name="191154957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191154957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191154957">(Mar 19 2020 at 18:20)</a>:</h4>
<p>I thought my rust.vim pluggin ought to just use the rustfmt.toml, but apparently it doesn't?</p>



<a name="191155818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191155818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191155818">(Mar 19 2020 at 18:27)</a>:</h4>
<p><span class="user-mention" data-user-id="198054">@mark-i-m</span> you need the right version of rustfmt too, just the right config isn't enough I think</p>



<a name="191197838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191197838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191197838">(Mar 20 2020 at 02:33)</a>:</h4>
<div class="codehilite"><pre><span></span>$ rustfmt --version
rustfmt 1.4.11-stable (9eb4b56 2020-01-29)
</pre></div>



<a name="191197841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191197841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191197841">(Mar 20 2020 at 02:33)</a>:</h4>
<p>?</p>



<a name="191197894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191197894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191197894">(Mar 20 2020 at 02:34)</a>:</h4>
<p>Hmm... it doesn't seem that far from the nightly version timewise?</p>



<a name="191516671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191516671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191516671">(Mar 23 2020 at 18:30)</a>:</h4>
<p>so I misremembered this Zulip thread, but, now that I have a solution for <em>my own</em> problem, here it is in case anyone else needs it: VSCode format on save w/o RLS <a href="https://github.com/rust-lang/rustfmt/issues/4092#issuecomment-602765344" target="_blank" title="https://github.com/rust-lang/rustfmt/issues/4092#issuecomment-602765344">https://github.com/rust-lang/rustfmt/issues/4092#issuecomment-602765344</a></p>



<a name="191516790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20fmt%20and%20emacs%20don%27t%20agree/near/191516790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20fmt.20and.20emacs.20don&#x27;t.20agree.html#191516790">(Mar 23 2020 at 18:30)</a>:</h4>
<p>and presumably this would work for any custom formatter command. and it works great with the undo log and instantly reloads, just like the real deal</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>